import Vue from 'vue'
import Router from 'vue-router'

import Body from '../components/body/body'
import Password from '../components/body/updatePassword'
import Car from '../components/body/car'
import CarDetail from '../components/body/carDetail.vue'
import Movie from '../components/body/movieDetail.vue'
import News from '../components/body/news'
import Train from '../components/body/train'
import SetBlog from '../components/blog/setblog'
import Blog from '../components/blog/blogList'






Vue.use(Router);

export default new Router({
  //历史模式
  mode:'history',
  routes: [
    //主页
    {
      path: '/',
      name: 'Body',
      component: Body,
      meta: {
        keepAlive: true // 需要被缓存
      }
    },
    //修改密码
    {
      path: '/password',
      name: 'password',
      component:Password,
      meta: {
        keepAlive: true // 需要被缓存
      }
      //子路由
      // children:[
      //   {path:'/password/1',component:password1},
      //   {path:'/password/:name',component:password2},
      //   {path:'/password/3',component:password3},
      // ]
    },
    //品牌车型
    {
      path: '/car/:id',
      name: 'car',
      component:Car,
      meta: {
        keepAlive: true ,// 需要被缓存
        requiresAuth: true
      }
    },
    //车型
    {
      path: '/carDetail/:id',
      name: 'CarDetail',
      component:CarDetail,
      meta: {
        keepAlive: true // 需要被缓存
      }
    },
    //电影详情页
    {
      path: '/movieDetail/:id',
      name: 'MovieDetail',
      component:Movie,
      meta: {
        keepAlive: true // 需要被缓存
      }
    },
    /*新闻详情页*/
      {
          path: '/newsDetail/:channel',
          name: 'NewsDetail',
          component:News,
          meta: {
              keepAlive: true // 需要被缓存
          }
      },

      /*新闻详情页*/
      {
          path: '/train',
          name: 'Train',
          component:Train,
          meta: {
              keepAlive: true // 需要被缓存
          }
      },
      //发表博客
      {
          path: '/setBlog',
          name: 'SetBlog',
          component:SetBlog,
          meta: {
              keepAlive: true // 需要被缓存
          }
      },
      //博客列表
      {
          path: '/blog',
          name: 'Blog',
          component:Blog,
          meta: {
              keepAlive: true // 需要被缓存
          }
      },





  ]
})
